package com.bjpowernode.api.dto;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.io.Serializable;

/**
 * @author 麦翔盛
 * @ClassName: RFCResult
 * @Package: com.bjpowernode.api.dto
 * @description: 远程调用响应 remote proceed control result
 * @date 2022/5/26 22:42
 */
public class RPCResult implements Serializable {
    /**
     * 是否调用成功
     */
    boolean result;

    /**
     * 响应码
     */
    int code;

    /**
     * 详细信息
     */
    String message;

    public RPCResult() {
    }

    public RPCResult(boolean result, int code, String message) {
        this.result = result;
        this.code = code;
        this.message = message;
    }

    public static RPCResult fail(int code,String message){
        return new RPCResult(false,code,message);
    }

    public static RPCResult ok(String message){
        return new RPCResult(true,1,message);
    }


    public boolean isResult() {
        return result;
    }

    public void setResult(boolean result) {
        this.result = result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
